<?php namespace module\news;

use module\WfMessage;
use system\model\ReplyNews;

class Message extends WfMessage{
	//显示消息录入表单的
	public function SonDisplay() {
		return View::fetch( 'module/news/template/display.html' );
	}

	//将回复内容保存到模块表里
	public function submit( $kid ) {
		$Model = new ReplyNews();
		// $id=$Model->where('kid',$kid)->pluck('id');
		$data  = json_decode( Request::post( 'data' ), TRUE );
		foreach ( $data as $d ) {
			$Model['title']       = $d['title'];
			$Model['description'] = $d['description'];
			$Model['thumb']       = $d['thumb'];
			$Model['url']         = $d['url'];
			$Model['type']        = $d['type'];
			$Model['content']        = $d['content'];
			$Model['kid']         = $kid;
			$Model['id']         = $d['id'];
			$Model->save();
		}

		return TRUE;
	}

	public function getData($kid)
	{
		return Db::table('reply_news')->where('kid',$kid)->get();
	}
}